package com.bestcem.xm.member.mq;//package com.bestcem.xm.member.mq;
//
//import com.bestcem.xm.config.RabbitMqConstantConfig;
//import org.springframework.amqp.core.*;
//import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class MemberDbRabbitConfig {
//
//    @Autowired
//    private RabbitMqConstantConfig rabbitMqConstantConfig;
//
//    @Bean("memberDbQueue")
//    public Queue memberDbQueue() {
//        return new Queue(rabbitMqConstantConfig.getAppBpMemberMemberDbQueue(), true,
//                false, false);
//    }
//
//    @Bean("memberDbExchange")
//    public DirectExchange memberDbExchange() {
//        return new DirectExchange(rabbitMqConstantConfig.getAppBpMemberMemberDbExchange(), true,
//                false);
//    }
//
//    @Bean("memberDbBinding")
//    public Binding memberDbBinding() {
//        return BindingBuilder.bind(memberDbQueue()).to(memberDbExchange())
//                .with(rabbitMqConstantConfig.getAppBpMemberMemberDbRoutingKey());
//    }
//
//    @Bean("memberDbContainerFactory")
//    public RabbitListenerContainerFactory<?> memberDbContainerFactory(ConnectionFactory connectionFactory) {
//        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
//        // 配置为手动确认
//        factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
//        factory.setConnectionFactory(connectionFactory);
//        return factory;
//    }
//}
